package cn.lg.soar.system.biz.modules.general.entity;

import cn.lg.soar.core.annotations.constraints.group.Create;
import cn.lg.soar.core.annotations.constraints.group.Update;
import cn.lg.soar.database.base.entity.BaseEntity;
import cn.lg.soar.database.translate.TranslateByEntity;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

/**
 * 模板
 * @author luguoxiang
 * @since 2025-03-03
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Data
@Schema(description = "模板")
@TableName("lg_sys_template")
public class Template extends BaseEntity {

    /**  */
    @NotNull(message = "主键不能为空", groups = { Update.class })
    @ExcelIgnore
    @Schema(description = "主键")
    @TableId
    private Long id;

    /** 分组id（0是无分组） */
    @TranslateByEntity(TemplateGroup.class)
    @NotNull(message = "分组id（0是无分组）不能为空", groups = { Create.class })
    @ExcelProperty(value = "分组id（0是无分组）")
    @Schema(description = "分组id（0是无分组）")
    private Long groupId;

    /** 编码 */
    @NotBlank(message = "编码不能为空", groups = { Create.class })
    @ExcelProperty(value = "编码")
    @Schema(description = "编码")
    private String code;

    /** 类型(数据字典：TemplateTypeEnum) */
    @NotNull(message = "类型不能为空", groups = { Create.class })
    @ExcelProperty(value = "类型(0文件，1纯文本，2富文本)")
    @Schema(description = "类型(数据字典：TemplateTypeEnum)")
    private Integer type;

    /** 名称 */
    @NotBlank(message = "名称不能为空", groups = { Create.class })
    @ExcelProperty(value = "名称")
    @Schema(description = "名称")
    private String name;

    /** 备注 */
    @ExcelProperty(value = "备注")
    @Schema(description = "备注")
    private String remark;

    /** 排序 */
    @ExcelProperty(value = "排序")
    @Schema(description = "排序")
    private Integer sort;

    /** 状态（数据字典：DataStatusEnum）*/
    @NotNull(message = "状态不能为空", groups = { Create.class })
    @ExcelProperty(value = "状态（0启用，1禁用）")
    @Schema(description = "状态（数据字典：DataStatusEnum）")
    private Integer status;

    /** 内容 */
    @NotNull(message = "内容不能为空", groups = { Create.class })
    @ExcelProperty(value = "内容")
    @Schema(description = "内容")
    private String content;

    @JsonIgnore
    @Override
    public Long primaryKey() {
        return this.id;
    }

}
